#include "TextureManager.hpp"
#include <iostream>

TextureManager* TextureManager::inst = NULL;
TextureManager::TextureManager(void)
{
}


TextureManager::~TextureManager(void)
{
}

sf::Texture* TextureManager::Get(std::string filename){
	if(all_imgs.count(filename)==0){
			sf::Texture texture;
			if (!texture.loadFromFile(filename))
			{
				std::cerr << "Critical failure." << std::endl;
				exit(EXIT_FAILURE);
			}else
				all_imgs[filename] = texture;
		}
        return &(all_imgs[filename]);
}

TextureManager* TextureManager::Instance(){
	if(inst == NULL)
		inst = new TextureManager();
	return inst;
}